﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EditBaiViet.ascx.cs" Inherits="CMS.Web.ListManager.EditBaiViet" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<table align="center" width="98%" cellpadding="0" cellspacing="0" class="Table_Border" style="BORDER-COLLAPSE: collapse">
    <tr>
        <td colspan="2" class="Table_Title">
            <table width="100%" border="0">
                <tr>
                    <td style="width:40%" align="left"><asp:label id="LBL_Title" Runat="server" ForeColor="White" Font-Names="Verdana"></asp:label></td>
                    <td align="right" style="width:60%"></td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td colspan="2" class="Col_Left_Right">
            <em>
            Các trường có dấu <span style="color: red">* </span>là bắt buộc </em>
        </td>
    </tr>   
    <tr>
        <td class="Col_Left_Right" style="width:25%">
            <span style="color: red">*</span> Nhóm thể loại:</td>
        <td class="Col_Right" style="width:75%">
            <asp:DropDownList ID="drpTheLoai" runat="server" CssClass="TextBox" DataTextField="TenTheLoai" DataValueField="ID" Height="22">
            </asp:DropDownList></td>
    </tr>    
    <tr>
        <td class="Col_Left_Right" style="width:25%"><span style="color: red">*</span> Tiêu đề:</td>
        <td class="Col_Right" style="width:75%">
            <asp:TextBox ID="txtTieuDe" runat="server" Width="90%" CssClass="TextBox" MaxLength="250"></asp:TextBox>
        </td>
    </tr>
    
    <tr>
        <td class="Col_Left_Right">Hình ảnh:</td>
        <td class="Col_Right">
            <asp:FileUpload ID="txtImage" runat="server" Width="76%"/>
            <%--<asp:TextBox ID="txtImageTemp" runat="server" Width="75%" CssClass="TextBox" MaxLength="250"></asp:TextBox>
            <input id="Button1" type="button" value="Browse..." style="height:21px; width:65px" onclick="ShowUpload('','<%=txtImage.ClientID%>','0');"/>--%>
        </td>
    </tr>
    <tr>
        <td class="Col_Left_Right"></td>
        <td class="Col_Right">
            <a id="lbn_ExitsF" class="DownloadLink" href="download.aspx?fileName=<%=getFileDinhKem()%>&pathFolder=''"><%=getFileDinhKem()%></a>
        </td>
    </tr>
    <tr>
        <td class="Col_Left_Right">Chú thích ảnh:</td>
        <td class="Col_Right">
            <asp:TextBox ID="txtImgDescr" runat="server" Width="90%" CssClass="TextBox" MaxLength="160"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td class="Col_Left_Right">Tóm tắt:</td>
        <td class="Col_Right">            
            <asp:TextBox ID="txtSum" runat="server" Width="90%" TextMode="MultiLine" Rows="4" CssClass="TextArea" MaxLength="500"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td class="Col_Left_Right"><span style="color: red">*</span> Ngày đăng bài:</td>
        <td class="Col_Right">
            <asp:TextBox ID="txtNgayDang" runat="server" Width="100px" CssClass="TextBox" MaxLength="10"></asp:TextBox>
            (dd/MM/yyyy)
            </td>
    </tr>
     <tr>
        <td class="Col_Left_Right">Nguồn tin:</td>
        <td class="Col_Right">
            <asp:TextBox ID="txtAuthor" runat="server" Width="50%" CssClass="TextBox" MaxLength="160"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td class="Col_Left_Right">Trạng thái:</td>
        <td class="Col_Right">
            <asp:CheckBox ID="chkState" runat="server"/>
        </td>
    </tr>
    <tr>
        <td class="Col_Left_Right">Nội dung:</td>
        <td class="Col_Right"></td>
    </tr>
    <tr>
        <td colspan="2">
            <fckeditorv2:fckeditor id="txtBody" runat="server" ToolbarSet='HSCMS_Basic' Height="400px" Width="98%" BasePath="~/FCKeditor/"/>
        </td>
    </tr>
    <tr class="Row_Button">
        <td></td>
        <td align="left">
            <asp:button id="btnOK" runat="server" CssClass="Button" Text="Cập nhật" Width="80px" OnClick="btnOK_Click"></asp:button>
            <asp:button id="btnReset" runat="server" CssClass="Button" Text="Nhập lại" CausesValidation="False" Width="80px" OnClick="btnReset_Click"></asp:button>
            <asp:button id="btnCancel" Runat="server" CssClass="Button" Text="Bỏ qua" CausesValidation="False" Width="80px" OnClick="btnCancel_Click"></asp:button>
            <input type="hidden" id="hidID" name="hidID" runat="server" />
            <input type="hidden" id="hidAnhDaiDien" name="hidAnhDaiDien" runat="server" />
        </td>
    </tr>
</table>

<script language="javascript">
     jQuery(function($){
        $("#<%=txtNgayDang.ClientID %>").datepicker();
    });
		
	function validator() {	    
        title = $("#<%=txtTieuDe.ClientID%>").val();      
        datePost = $("#<%=txtNgayDang.ClientID%>").val();
        var date1 = '<%=DateTime.Now.ToString("dd/MM/yyyy") %>';
        strMessage = "";
        if (util.Trim(title) == ""){            
            strMessage = "- Xin nhập vào tiêu đề!";            
        }
        
        if (util.Trim(datePost) == ""){            
            strMessage += "\n- Xin nhập vào ngày đăng tin!";            
        } 
//        else {            
//            if (CompDate(date1, datePost))
//            {
//                strMessage += "\n- Ngày đăng tin phải lớn hơn ngày hiện tại!";
//            }
//        }

        if ($("#<%=txtSum.ClientID%>").val().length > 500)
        {
            strMessage = "- Tóm tắt phải nhỏ hơn 500 ký tự!";
        }
        
        if (strMessage != "")
        {
            alert(strMessage);
            return false;
        }
        
        var file = document.getElementById("<%=txtImage.ClientID%>");
        var fileName = file.value;   
        if (fileName != "" && !isImage(fileName))
        {
            alert("Xin vui lòng chọn file có kiểu: gif|jpg|jpeg|jpe|png|bmp|tif ");
            return false;
        }

        return true;       
    }  
</script>